package com.heartware.sh.blackhole.presenter.impl;

import android.view.View;

import com.heartware.sh.blackhole.presenter.ILoginPresenter;
import com.heartware.sh.blackhole.retrofit.NetWorkApi;
import com.heartware.sh.blackhole.view.ILoginView;

/**
 * Created by Administrator on 2016/12/1 0001.
 */
public class ILoginPresenterImpl implements ILoginPresenter {

    private ILoginView loginView;

    public ILoginPresenterImpl(ILoginView loginView){
        this.loginView = loginView;
    }

    @Override
    public void clear() {
        loginView.clear();
    }

    @Override
    public void doLogin(String userName, String pwd) {
        loginView.setProgressBarVisiblity(View.VISIBLE);

//        new Handler().postDelayed(new Runnable() {
//            @Override
//            public void run() {
//                loginView.loginResult(true, "");
//            }
//        }, 5000);

        NetWorkApi.doLogin(userName, pwd, loginView);

    }

    @Override
    public void setProgressBarVisiblity(int visiblity) {
        loginView.setProgressBarVisiblity(visiblity);

    }


    @Override
    public void doReg(String userName, String pwd) {
        loginView.setProgressBarVisiblity(View.VISIBLE);

        NetWorkApi.doReg(userName, pwd, loginView);
    }
}
